package name.cyrax.red.jpv.impl.vectors;

import name.cyrax.red.jpv.api.adapters.NumericAccessor;
import name.cyrax.red.jpv.api.funcs.FunctorInstance;
import name.cyrax.red.jpv.api.funcs.info.ValueType;
import name.cyrax.red.jpv.api.vectors.VectorFactory;
import name.cyrax.red.jpv.impl.funcs.DefaultFunctorInstances;

public abstract class LongVectorImpl extends VectorImpl<Long>
{

	@Override public VectorFactory<Long> factory()
	{
		return VectorFactories.getLong();
	}

	@Override public <T> T detectType(NumericAccessor<T> accessor)
	{
		return accessor.asLong(asLong());
	}

	@Override public int getInteger(int index)
	{
		return (int) getLong(index);
	}

	@Override public abstract long getLong(int index);

	@Override public double getDouble(int index)
	{
		return getLong(index);
	}

	@Override public Long getNumber(int index)
	{
		return getLong(index);
	}

	@Override public FunctorInstance getFunctorInstance()
	{
		return FUNC_INST; 
	}

	private static final FunctorInstance FUNC_INST = DefaultFunctorInstances.VECTOR.getFunctorInstance(
		DefaultFunctorInstances.FUNCTOR_STUB_VECTOR, null, ValueType.LONG);
}
